﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Threading.Thread;

namespace AsyncUnitTest
{
    public class MyTest2
    {
        public static void Go()
        {
            var aa=TaskDemoAsync().Result;
            //var a = TaskDemoAsync().Result;
            //TaskDemoAsync();
            WriteLine("dsadas");
            //Task t1 = Task.Run(() =>
            //{
            //    Sleep(200);
            //    WriteLine("111");
            //});
            //Task t2 = Task.Run(() =>
            //{
            //    Sleep(100);
            //    WriteLine("222");
            //});
            //Task t3 = Task.Run(() =>
            //{
            //    Sleep(300);
            //    WriteLine("333");
            //});
            //Task t4 = Task.Run(() =>
            //{
            //    Sleep(100);
            //    WriteLine("444");
            //});
        }


        private static Task<int> TaskDemoAsync()
        {
            WriteLine("111");
            Task.Delay(2000);
            WriteLine("222");
            Task.Delay(2000);
            WriteLine("333");
            Task.Delay(1000);
            WriteLine("444");
            Task.Delay(1000);
            WriteLine("555");
            return Task.FromResult(666);
        }
    }
}
